﻿using B.S.Ingredients.APIWrite.Applications.Command;
using B.S.Ingredients.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Ingredients.APIWrite.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ShopsController : ControllerBase
    {
        public ShopsController(IMediator mediator,ILogger<ShopsController> logger)
        {
            Mediator = mediator;
            Logger = logger;
        }

        public IMediator Mediator { get; }
        public ILogger<ShopsController> Logger { get; }
        [HttpPost]
        public async Task<APIResult<int>> ShopsCreate(ProductCreateCommand request )
        {
           return await Mediator.Send(request);
        }

        [HttpPost]
        public IActionResult FormQueryImg(IFormFile files)
        {
            var n=Guid.NewGuid();
            var filea=Directory.GetCurrentDirectory+"/wwwroot/Img"+n+files.FileName;
            using (FileStream fs=new FileStream(filea,FileMode.Create))
            {

            }

        }
        
    }
}
